@echo off

if %JDK_HOME%.==. goto SETHOME

del /Q *.jar
del /Q java\lang\*.class
del /Q java\io\*.class
del /Q java\util\*.class
del /Q javax\events\*.class
del /Q javax\memory\*.class

echo Compiling ...
%JDK_HOME%\bin\javac -target 1.1 java\lang\*.java java\io\*.java java\util\*.java javax\events\*.java javax\memory\*.java
if errorlevel==1 goto ERROR

echo Making java jar file...
%JDK_HOME%\bin\jar cf java.jar java\lang\*.class java\io\*.class java\util\*.class
copy java.jar ..\lib

echo Making javax jar file...
%JDK_HOME%\bin\jar cf javax.jar javax\events\*.class javax\memory\*.class
copy javax.jar ..\lib
goto EXIT

:ERROR
echo Compilation error
goto EXIT

:SETHOME
echo Missing JDK_HOME environment variable. For example: SET JDK_HOME=C:\JDK1.3

:EXIT
pause